<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
</head>
<link href="${ctx}/css/main/base.css" rel="stylesheet" type="text/css"/>
<link href="${ctx}/css/main/main.css" rel="stylesheet" type="text/css"/>

<body class="m_6" style="over">
<div id="main">
	<div class="zdsz" id="select1">
		<div class="tab"><h3 onclick="f1();">管理角色</h3><h3 class="sel" onclick="f2();">新建角色</h3><h3 onclick="f3();">调整角色序号高低</h3><h3 onclick="f4();">添加／删除权限</h3></div>
		<form action="role_create.action" method="post">
		<div class="zd_gut">
		<ul class="block">
		<li>
				<div class="m_han2 font14">提示：<br/>请合理设置角色序号，它决定了用户的排列位置，也代表了一种管理层次，序号越小，管理层次越高</div>
				<table width="70%" border="0" align="center" cellpadding="0" cellspacing="0" class="tab_1 center">
				  <tr>
					<td class="w1 bg4">角色排序号：</td>
					<td><input type="text" name="baseRole.roleOrder" value="${baseRole.roleOrder}" class="fl_l"/><div id="errOrder"></div></td>
				  </tr>
				  <tr>
					<td class="w1 bg4">角色名称：</td>
					<td><input type="text" name="baseRole.roleName" value="${baseRole.roleName}" class="fl_l"/><div id="errName"></div></td>
				  </tr>
		  		</table>
				<div class="zc_but2"><input type="button" onclick="createRole();" value="确 定" class="log_f zc_b"></div>
		</li>
		</ul>
		<div class="bihe"></div>
		</div>
		</form>
	</div>
</div>
</body>
</html>
<script type="text/javascript" src="${ctx}/scripts/commons/validation.js"></script>
<script type="text/javascript">
<!--
	
	function f1(){
		window.location = "${ctx}/role/role!index.action";
	}
	function f2(){
		window.location = "${ctx}/role/role!preCreate.action";
	}
	function f3(){
		window.location = "${ctx}/role/role!preModifyOrder.action";
	}
	function f4(){
		window.location = "${ctx}/role/role!preManagePermission.action";
	}
	
	function createRole(){
		var roleOrder = document.getElementById("baseRole.roleOrder").value;
		var roleName = document.getElementById("baseRole.roleName").value;
		var flag1 = /^[0-9]$/;
		
		if(roleOrder.length == 0){
			document.getElementById("errOrder").innerHTML = "<font color='red'>序号不能为空</font>";
		   return false;
		}
		if(isNaN(parseInt(roleOrder))){
			document.getElementById("errOrder").innerHTML = "<font color='red'>序号必须是数字</font>";
		   return false;
		}
		if(roleOrder.length > 4){
			document.getElementById("errOrder").innerHTML = "<font color='red'>序号不能多于4位</font>";
		   return false;
		}
		if(roleName.length == 0){
			document.getElementById("errName").innerHTML = "<font color='red'>角色名称不能为空</font>";
		   return false;
		}
		if(roleName.length > 50){
			document.getElementById("errName").innerHTML = "<font color='red'>角色名称不能多于50</font>";
		   return false;
		}
		if(roleName.length > 0 && hasSpecialChart(roleName)){
			document.getElementById("errName").innerHTML = "<font color='red'> 角色名称不能有特殊字符!</font>";
			return false;
		}
		
		document.forms[0].submit();
	}
//-->
</script>
